﻿<?php include $this->admin_tpl('meta');?>
<title>添加管理员</title>
</head>
<body>
<article class="page-container">
<div class="formdoby_normal"> 
	<form method="post" onsubmit="return dosub(this)">
	<input type="hidden" name="id" value="<?php echo $data['id'];?>" class="input-text w_300">
	<div class="tabCon formdoby_info" style="display: block;">
		<div class="yzm-table-box">
		<table width="100%" class="table table-border yzmcms_table">
			<tbody>
			<tr>
				<td width="120"><span class="c-red">*</span>品牌名称：</td> 
				<td>
				<input type="text" name="name" autocomplete="off" value="<?php echo $data['name'];?>" class="input-text" placeholder="请输入店铺名称">
				</td>
			</tr>
			<tr>
				<td width="120"><span class="c-red">*</span>绑定聚水潭：</td> 
				<td>
					<input type="hidden" name="jst_id" value="<?php echo $data['jst_id'];?>" class="input-text">
					<button class="layui-btn layui-btn-primary dropdown-jst" style="height:28px;width:90px;padding:0 10px;">
					<span><?php echo $data['jst_name']??'请选择';?></span>
					<i class="layui-icon layui-icon-down layui-font-12" style="vertical-align: center;"></i>
					</button>
				</td>
			</tr>
			<tr>
				<td width="120"><span class="c-red">*</span>是否开启：</td> 
				<td>
					<span class="span_input">
						<label class="label_radio"><input name="status" type="radio" value="1" <?php if($data['status']){?>checked="1"<?php } ?>> 开启</label>
						<label class="label_radio"><input name="status" type="radio" value="0" <?php if(!$data['status']){?>checked="1"<?php } ?>> 禁用</label>
					</span>
				</td>
			</tr>
			<tr>
				<td width="120"><span class="c-red">*</span>是否佑晟：</td> 
				<td>
					<span class="span_input">
						<label class="label_radio"><input name="is_ys" type="radio" value="1" <?php if($data['is_ys']){?>checked="1"<?php } ?>> 是</label>
						<label class="label_radio"><input name="is_ys" type="radio" value="0" <?php if(!$data['is_ys']){?>checked="1"<?php } ?>> 否</label>
					</span>
				</td>
			</tr>
			</tbody>
		</table>
		</div>
	
	</div>
	<div class="footer_btn">
		<input type="hidden" name="dosubmit" value="1">
		<input class="btn btn-primary radius" type="submit" value="提 交">
		<input class="btn btn-default radius" type="button" value="取 消" onclick="yzmcms_close()">	
	</div>
	</form>
</div>
</article>
<?php include $this->admin_tpl('footer');?>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/layui/layui.js"></script>
<script type="text/javascript" src="<?php echo STATIC_URL;?>plugin/layui/modules/xm-select.js"></script>
<script type="text/javascript">
layui.use(function(){
	dropdown = layui.dropdown; //下拉菜单
	laydate = layui.laydate;
	dropdown.render({
		elem: '.dropdown-jst',
		// trigger: 'hover',
		// 此处的 data 值，可根据 done 返回的 res 遍历来赋值
		data: <?php echo json_encode($this->jst_arr);?>,
		click: function(obj){
			$('input[name="jst_id"]').val(obj.id);
			this.elem.find('span').html(obj.title);
		}
	});
});
function dosub(obj){
	if(obj.name.value==''){
		layer.msg('请输入品牌名称！', {icon:2});
		return false;
	}
	$.ajax({
		type: 'POST',
		url: '<?php echo U('brand_list',['type'=>'add']);?>', 
		data: $(obj).serialize(),
		dataType: "json", 
		success: function (msg) {
			if(msg.status == 1){
				layer.msg(msg.message, {icon:1, time:800}, function(){
					parent.table.reload('table');
					var index = parent.layer.getFrameIndex(window.name); // 先得到当前 iframe 层的索引
					parent.layer.close(index); // 再执行关闭
				});
			}else{
				layer.msg(msg.message, {icon:2});
			}
		}
	})		 
	return false;			 
}
</script> 

</body>
</html>